package net.java.nioserver;

import net.java.nioserver.utils.Pool;
import net.java.nioserver.operations.OpAccept;
import net.java.nioserver.operations.OpRead;
import net.java.nioserver.operations.OpWrite;

import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.util.concurrent.ExecutorService;

/**
 * @author Leonid Shlyapnikov
 */
public abstract class BasicService implements Service {

    protected final InetSocketAddress address;

    protected final ExecutorService executor;

    protected final Pool<ByteBuffer> byteBufferPool;

    protected final OpAccept opAccept;

    protected final OpRead opRead;

    protected final OpWrite opWrite;

    protected BasicService(BasicServiceBuilder builder) {
        this.address = builder.address;
        this.executor = builder.executor;
        this.byteBufferPool = builder.byteBufferPool;
        this.opAccept = builder.opAccept;
        this.opRead = builder.opRead;
        this.opWrite = builder.opWrite;
    }
}
